﻿<%@ Page Title="" Language="C#" MasterPageFile="~/OneColumn.Master" AutoEventWireup="true"
    CodeBehind="OrderReport.aspx.cs" Inherits="KCL.Report.OrderReport" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PageTitle" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PageHeader" runat="server">
    <script type="text/javascript" src="../styles/ui/jquery.ui.core.js"></script>   
    <script type="text/javascript" src="../styles/ui/jquery.ui.datepicker.js"></script>
	<script type="text/javascript" src="../styles/ui/i18n/jquery.ui.datepicker-vi.js"></script>
	<script type="text/javascript" src="../styles/js/jquery.PrintArea.js"></script>
	<link rel="stylesheet" type="text/css" href="../styles/themes/base/jquery.ui.all.css" />
    <script type="text/javascript">
        $(document).ready(function () {
            $(".datepicker").datepicker($.datepicker.regional['vi']);
        });

        function doPrint() {
            $("#printArea").printArea();
        }
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <table>
        <tr>
            <td colspan="5">
                <span style="font-size: 25px; color: #474747">TỔNG SỐ ĐƠN HÀNG</span>
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                Từ ngày&nbsp;&nbsp;
            </td>
            <td>
                <%--<asp:Calendar ID="dtFromDate" runat="server"></asp:Calendar>--%>
                <asp:TextBox ID="txtFromDate" runat="server" class="datepicker" ReadOnly="true"></asp:TextBox>
            </td>
            <td>
                &nbsp;&nbsp;đến ngày&nbsp;&nbsp;
            </td>
            <td>
                <%--<asp:Calendar ID="dtToDate" runat="server"></asp:Calendar>--%>
                <asp:TextBox ID="txtToDate" runat="server" class="datepicker" ReadOnly="true"></asp:TextBox>
            </td>
            <td>
                &nbsp;&nbsp;<asp:Button ID="btnSearch" runat="server" Text="Tìm" Width="120" OnClick="btnSearch_Click" />
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
        </tr>
    </table>
    <div id="printArea">
        <asp:ObjectDataSource ID="dsOrderReport" TypeName="KCL.Code.Data.Search" SortParameterName="sortExpression"
            SelectMethod="GetOrders" SelectCountMethod="GetTotalOrder" EnablePaging="True"
            runat="server" OnSelecting="dsOrderReport_Selecting">
            <SelectParameters>
                <asp:ControlParameter ControlID="txtFromDate" Name="txtFromDate" PropertyName="Text"
                    Type="String" />
                <asp:ControlParameter ControlID="txtToDate" Name="txtToDate" PropertyName="Text"
                    Type="String" />
                <asp:Parameter Name="sortExpression" Type="String" />
                <asp:Parameter Name="maximumRows" Type="Int32" />
                <asp:Parameter Name="startRowIndex" Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <asp:GridView ID="gridOrderReport" AllowPaging="false" AutoGenerateColumns="False"
            BackColor="Wheat" BorderColor="Firebrick" BorderStyle="Ridge" BorderWidth="1px"
            CellPadding="7" DataSourceID="dsOrderReport" GridLines="None" Width="100%" runat="server"
            EnableModelValidation="True">
            <HeaderStyle BackColor="Black" ForeColor="Azure" Font-Bold="true" Wrap="false" />
            <FooterStyle ForeColor="Maroon" BackColor="DarkGoldenrod" />
            <PagerStyle ForeColor="Snow" HorizontalAlign="Right" BackColor="SaddleBrown" />
            <RowStyle BackColor="Ivory" />
            <Columns>
				<asp:BoundField HeaderText="Số đơn hàng" DataField="code" SortExpression="code" />
				<asp:BoundField HeaderText="Mã khách hàng" DataField="customerId" SortExpression="customerId" />
				<asp:BoundField HeaderText="Tên khách hàng" DataField="customerName" SortExpression="customerName" />
				<asp:BoundField HeaderText="Ngày ra hóa đơn" DataField="createdDate" SortExpression="createdDate" />
				<asp:BoundField HeaderText="Tổng tiền" DataField="totalPrice" SortExpression="totalPrice" />
				<asp:BoundField HeaderText="Trả trước" DataField="prePay" SortExpression="prePay" />
				<asp:BoundField HeaderText="Còn lại" DataField="remain" SortExpression="remain" />
				<asp:TemplateField HeaderText="Trạng thái đơn hàng" SortExpression="isFinished">
					<ItemTemplate>
						<%# Convert.ToBoolean(Eval("isFinished")) ? "Hoàn thành" : "Chưa hoàn thành"%>
					</ItemTemplate>
				</asp:TemplateField>
			</Columns>
            <AlternatingRowStyle BackColor="SeaShell" />
        </asp:GridView>
        <i>Đang xem trang
            <%=gridOrderReport.PageIndex + 1%>
            /
            <%=gridOrderReport.PageCount %></i>
    </div>
    <input id="btnPrint" type="button" value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
        onclick="doPrint()" />
</asp:Content>
